#include <iostream>
#include <string>
#include "DatabaseUtil.h"
#include "HttpUtil.h"

int main()
{
    //开启流媒体服务
    pid_t pid = fork();
    if(pid == 0)
    {
        execl("./MediaServer", "./MediaServer", nullptr);
        exit(0);
    }
    else if (pid > 0) {
        std::cout << "流媒体服务进程创建成功，进程PID:" << pid << std::endl;
    } else {
        std::cout << "流媒体服务进程创建失败，将无法进行视频流转发" << std::endl;
    }

    //初始化数据库和http服务并持续监听
    DatabaseUtil::GetGetInstance()->Init();
    HttpUtil::GetGetInstance()->Init();

    //释放数据库资源,关闭服务器套接字
    HttpUtil::DeleteInstance();
    DatabaseUtil::DeleteInstance();

    return 0;
}

//export LD_LIBRARY_PATH=/home/kouseki/AiServer/lib/jsoncpp/lib:$LD_LIBRARY_PATH